class UserController < ApplicationController
def login
      @user = User.new
      @user.username = params[:username]
    end

    def process_login
      if user = User.authenticate(params[:user])
        session[:id] = user.id # Remember the user's id during this session
        session[:user] = user.username
        session[:role] = user.role
        redirect_to session[:return_to] || '/'
      else
        flash[:error] = 'Invalid login.'
        redirect_to session[:return_to] || '/', :username => params[:user][:username]
      end
    end

    def logout
      reset_session
    #  flash[:message] = 'Logged out.'
    #  redirect_to :action => 'map'
    redirect_to session[:return_to] || '/'
    end

    def my_account
    end

    
   

end
